<?php

use app\assets\TableAsset;
use app\models\KeyMap;
use yii\helpers\Html;

/**
 * @var $this yii\web\View
 * @var $recharge app\models\UserCardRecharge
 */

TableAsset::register($this);

$this->title = '卡充值详情';
$this->params['breadcrumbs'][] = '财务管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<table class="table table-striped table-bordered table-hover">
    <tr>
        <th>编号</th>
        <td><?php echo $recharge->id;?></td>
    </tr>
    <tr>
        <th>用户</th>
        <td><?php echo empty($recharge->uid) ? '----' : Html::a(Html::encode($recharge->user->username), ['/admin/user/user-view', 'id' => $recharge->uid]);?></td>
    </tr>
    <tr>
        <th>代理商</th>
        <td><?php echo empty($recharge->agent_id) ? '----' : Html::a(Html::encode($recharge->agent->username), ['/admin/user/agent-view', 'id' => $recharge->agent_id]);?></td>
    </tr>
    <tr>
        <th>卡</th>
        <td><?php echo empty($recharge->card->iccid) ? '----' : Html::encode($recharge->card->iccid);
            echo '<br />';
            echo empty($recharge->card->msisdn) ? '----' : Html::encode($recharge->card->msisdn);
            echo '<br />';
            echo empty($recharge->card->imsi) ? '----' : Html::encode($recharge->card->imsi);?></td>
    </tr>
    <tr>
        <th>套餐</th>
        <td><?php echo Html::encode($recharge->package->name);?></td>
    </tr>
    <tr>
        <th>充值有效期</th>
        <td><?php echo $recharge->term_length, KeyMap::getValue('card_term_length_unit', $recharge->term_length_unit);?></td>
    </tr>
    <tr>
        <th>价格</th>
        <td><?php echo $recharge->price;?></td>
    </tr>
    <tr>
        <th>金额</th>
        <td><?php echo $recharge->money;?></td>
    </tr>
    <tr>
        <th>支付方式</th>
        <td><?php echo KeyMap::getValue('user_card_recharge_trade_type', $recharge->trade_type);?></td>
    </tr>
    <tr>
        <th>平台交易流水号</th>
        <td><?php echo Html::encode($recharge->trade_no);?></td>
    </tr>
    <tr>
        <th>充值状态</th>
        <td><?php echo KeyMap::getValue('recharge_type', $recharge->recharge_type);?></td>
    </tr>
    <tr>
        <th>来源</th>
        <td><?php echo KeyMap::getValue('source', $recharge->source);?></td>
    </tr>
    <tr>
        <th>创建时间</th>
        <td><?php echo Yii::$app->formatter->asDatetime($recharge->create_time);?></td>
    </tr>
    <tr>
        <th>支付时间</th>
        <td><?php echo Yii::$app->formatter->asDatetime($recharge->pay_time);?></td>
    </tr>
    <tr>
        <th>卡更新时间</th>
        <td><?php echo Yii::$app->formatter->asDatetime($recharge->update_time);?></td>
    </tr>
    <tr>
        <th>充值次数</th>
        <td><?php echo $recharge->card->dgcs;?></td>
    </tr>
    <tr>
        <th>充值地区</th>
        <td>
        <?php echo empty($recharge->province) ? '----' : Html::encode($recharge->province);
                echo '/';
                echo empty($recharge->city) ? '----' : Html::encode($recharge->city);?>
        </td>
    </tr>
</table>
